package pers.qianyu.month_202101.date_20210124;

/**
 * 275. H 指数 II
 * https://leetcode-cn.com/problems/h-index-ii/
 *
 * @author mizzle rain
 * @date 2021-01-24 12:15
 */
public class HIndex {
    public int hIndex(int[] citations) {
        int len = citations.length;
        int left = 0, right = len;
        while (left < right) {
            int mid = left + right + 1 >> 1;
            if (citations[len - mid] >= mid) left = mid;
            else right = mid - 1;
        }
        return left;
    }
}
